Subsystem 3c-ii: in-game data commands as Discord slash commands (/pop /time /wipe /online /offline /team /alive) - #12
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…reg test Address final whole-branch review minors: ServerAutocompleteHandler now filters the guild's servers by the user's in-progress text (case-insensitive) before the 25-cap, so a server past the 25th alphabetically is reachable; CommandRegistrationTests now asserts the 'wipe' handler is registered (the count tripwire alone wouldn't catch a rename of the newly-surfaced /wipe). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new Discord “server data” slash-command surface that reuses the existing in-game ICommandHandler implementations, ensuring consistent reply formatting/localization between in-game and Discord while keeping the Discord path read-only and ephemeral.
Changes:
- Introduces
/pop,/time,/wipe,/online,/offline,/team,/aliveslash commands via a newServerCommandModule. - Adds server targeting infrastructure (autocomplete + resolver + handler adapter) and registers it in the Commands DI setup.
- Extends command localization with 3 new
command.server.*error strings and adds unit tests for server resolution and handler execution.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/RustPlusBot.Features.Commands.Tests/Servers/ServerResolverTests.cs | Adds unit tests for server targeting rules (0/1/many/explicit). |
| tests/RustPlusBot.Features.Commands.Tests/Servers/ServerQueryServiceTests.cs | Adds unit tests ensuring the synthetic CommandContext is built correctly and routed to the right handler. |
| tests/RustPlusBot.Features.Commands.Tests/CommandRegistrationTests.cs | Updates DI test wiring to include server services and asserts new registrations. |
| src/RustPlusBot.Features.Commands/Servers/ServerResolver.cs | Implements server selection logic + localized error outcomes. |
| src/RustPlusBot.Features.Commands/Servers/ServerResolution.cs | Adds a small result record for server resolution outcomes. |
| src/RustPlusBot.Features.Commands/Servers/ServerQueryService.cs | Adapts slash commands to existing in-game handlers via a synthetic context. |
| src/RustPlusBot.Features.Commands/Servers/ServerAutocompleteHandler.cs | Adds guild server-name autocomplete for the optional server slash option. |
| src/RustPlusBot.Features.Commands/Modules/ServerCommandModule.cs | Adds the 7 ephemeral slash commands and orchestrates resolve + query execution. |
| src/RustPlusBot.Features.Commands/Localization/CommandLocalizationCatalog.cs | Adds EN/FR strings for server-selection error cases. |
| src/RustPlusBot.Features.Commands/CommandServiceCollectionExtensions.cs | Registers ServerResolver and ServerQueryService into the Commands feature DI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ServerResolver ctor XML doc: 'servers' is the IServerService, not a list. - Rename ServerResolver test DefaultsToSingleServer_IgnoringArg -> DefaultsToSingleServer_WhenNoArg: it passes a null arg, so the name now matches what it covers. (The single-server + explicit-non-matching-arg -> 'unknown' path is already covered by ReturnsUnknownError_WhenArgNotRegistered.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subsystem 3c-ii — In-game data commands as Discord slash commands
Surfaces the read-only in-game
!commanddata set into Discord as native ephemeral slash commands. This is the final slice of subsystem 3.What's added — 7 slash commands
/pop!pop/time!time/wipe!wipe/online!online/offline!offline/team!team/alive!aliveAll replies are ephemeral (only the caller sees them), consistent with
/help//uptime//leader.serverparameter with autocomplete — defaults when one server is registered, disambiguates when several (filters by typed input, 25-cap)./steamidand/proxwere dropped (both in-game-caller-centric — irrelevant in Discord);/mute//unmuteexcluded (gate in-game output);!afkstays deferred.Architecture
All in the existing
RustPlusBot.Features.Commandsproject — no new project, entity, migration, event, option, or background service.ServerCommandModule(thinInteractionModuleBase) — the 7 slash commands.ServerAutocompleteHandler— server-name choices per guild.ServerResolver(tested) — the 0/1/many/explicit server-targeting rule.ServerQueryService(tested) — a thin adapter that builds a syntheticCommandContextand reuses the existing in-gameICommandHandlerinstances, so in-game and slash replies cannot drift. Reply text reuses existing localization keys; only threecommand.server.*errors are new (EN/FR).Verification
jb ReformatAndReorder-clean.Features.Commandssrc + tests changed.GuildId/ServerId/Culture, never the synthetic sender/args fields.🤖 Generated with Claude Code